package com.hziee.mail.model;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "address_info", schema = "mall", catalog = "")
public class AddressInfoEntity {
    private int addressId;
    private int userId;
    private String address;
    private String linkman;
    private String telephone;
    private Integer defaultAddress;

    @Id
    @Column(name = "address_id")
    public int getAddressId() {
        return addressId;
    }

    public void setAddressId(int addressId) {
        this.addressId = addressId;
    }

    @Basic
    @Column(name = "user_id")
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "address")
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Basic
    @Column(name = "linkman")
    public String getLinkman() {
        return linkman;
    }

    public void setLinkman(String linkman) {
        this.linkman = linkman;
    }

    @Basic
    @Column(name = "telephone")
    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    @Basic
    @Column(name = "default_address")
    public Integer getDefaultAddress() {
        return defaultAddress;
    }

    public void setDefaultAddress(Integer defaultAddress) {
        this.defaultAddress = defaultAddress;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AddressInfoEntity that = (AddressInfoEntity) o;
        return addressId == that.addressId &&
                userId == that.userId &&
                Objects.equals(address, that.address) &&
                Objects.equals(linkman, that.linkman) &&
                Objects.equals(telephone, that.telephone) &&
                Objects.equals(defaultAddress, that.defaultAddress);
    }

    @Override
    public int hashCode() {
        return Objects.hash(addressId, userId, address, linkman, telephone, defaultAddress);
    }
}
